<html>

<head>

<?php

include "../includes/constants.php";
include "../includes/functions.php";

if ($_POST[charname]!= "") {$charname = $_POST[charname];}
else {$charname = $_GET[charname];};
if ($_POST[curzone]!= "") {$curzone = $_POST[curzone];}
else {$curzone = $_GET[curzone];};
if ($_POST[newzone]!= "") {$newzone = $_POST[newzone];}
else {$newzone = $_GET[newzone];};

?>

<title>Character Mover</title>

</head>

<body>

<table border="0">
	<form method="post" action="">
	<tr>
		<td>Character Name:</td>
		<td><input type="text" name="charname" style="width: 100%" value="<?php echo $charname?>"></td>
	</tr>
	<tr>
		<td>Current Zone<br></td>
		<td>
<?php 

$q_curzone = "SELECT short_name FROM zone ORDER BY short_name ASC";
$r_curzone = mysql_query($q_curzone,$db);
echo "\t\t\t<select name=\"curzone\">\n";
do {
	echo "\t\t\t\t<option value=\"" . $row_curzone[short_name] . "\"";
	if ($curzone == $row_curzone[short_name]) echo " selected";
	echo ">" . $row_curzone[short_name] . "</option>\n";
} while ($row_curzone = mysql_fetch_array($r_curzone));
echo "\t\t\t</select>\n";

?>
		</td>
	</tr>
	<tr>
		<td>New Zone</td>
		<td>
<?php

$q_curzone = "SELECT short_name FROM zone ORDER BY short_name ASC";
$r_curzone = mysql_query($q_curzone,$db);
echo "\t\t\t<select name=\"newzone\">\n";
do {
	echo "\t\t\t\t<option value=\"" . $row_curzone[short_name] . "\"";
	if ($newzone == $row_curzone[short_name]) echo " selected";
	echo ">" . $row_curzone[short_name] . "</option>\n";
} while ($row_curzone = mysql_fetch_array($r_curzone));
echo "\t\t\t</select>\n";

?>
		</td>
	</tr>
	<tr>
		<td colspan="3" align="center">
			<button type="submit" style="width: 50%">Move</button>
			<button type="reset" style="width: 50%">Clear</button>
		</td>
	</tr>
	</form>
</table>

</body>

</html>
